package com.px.system.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.px.common.annotation.Excel;
import com.px.common.config.MinIoClientConfig;
import com.px.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

@Data
public class FlightUserVo extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 用户ID */
    @ApiModelProperty(value = "用户ID")
    private Long userId;

    /** 用户账号 */
    @ApiModelProperty(value = "用户账号")
    @Excel(name = "用户账号")
    private String userName;

    /** 用户昵称 */
    @ApiModelProperty(value = "用户昵称")
    @Excel(name = "用户昵称")
    private String nickName;

    /** 用户邮箱 */
    @ApiModelProperty(value = "用户邮箱")
    @Excel(name = "用户邮箱")
    private String email;

    /** 手机号码 */
    @ApiModelProperty(value = "手机号码")
    @Excel(name = "手机号码")
    private String phonenumber;

    /** 用户性别（0男 1女 2未知） */
    @ApiModelProperty(value = "用户性别（0男 1女 2未知）")
    @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
    private String sex;

    /** 头像地址 */
    @ApiModelProperty(value = "头像地址")
    @Excel(name = "头像地址")
    private String avatar;


    /** 帐号状态（0正常 1停用） */
    @ApiModelProperty(value = "帐号状态（0正常 1停用）")
    @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
    private String status;

    /** 最后登录IP */
    @ApiModelProperty(value = "最后登录IP")
    @Excel(name = "最后登录IP")
    private String loginIp;

    /** 最后登录时间 */
    @ApiModelProperty(value = "最后登录时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date loginDate;

    private String name;
    private String phone;
    private String idcard;
    private String idcardPositivePhoto;
    private String idcardReversePhoto;
    private String flightNo;
    private String flightPhoto;
    private String organizationCode;
    private String organizationName;
    private String address;

    public String getIdcardPositivePhoto() {
        if (null != idcardPositivePhoto && idcardPositivePhoto.startsWith("http")) {
            return idcardPositivePhoto;
        } else {
            return MinIoClientConfig.PREVIEW_END_POINT_URL + "/" + idcardPositivePhoto;
        }
    }

    public String getIdcardReversePhoto() {
        if (null != idcardReversePhoto && idcardReversePhoto.startsWith("http")) {
            return idcardReversePhoto;
        } else {
            return MinIoClientConfig.PREVIEW_END_POINT_URL + "/" + idcardReversePhoto;
        }
    }

    public String getFlightPhoto() {
        if (null != flightPhoto && flightPhoto.startsWith("http")) {
            return flightPhoto;
        } else {
            return MinIoClientConfig.PREVIEW_END_POINT_URL + "/" + flightPhoto;
        }
    }
}
